<?php

class Base_Controller extends CI_Controller {
	
	protected function view($title, $view, $data = null, $convert_new_line = FALSE) {
		$this->_view($title, $view, $data, $convert_new_line, "_TEMPLATE_/frame");
	}
	protected function view_admin($title, $view, $data = null, $convert_new_line = FALSE) {
		$this->_view($title, $view, $data, $convert_new_line, "_TEMPLATE_/frame_admin");
	}
	private function _view($title, $view, $data = null, $convert_new_line = FALSE, $template = "_TEMPLATE_/frame") {
		$data['title'] = $title;
		$data['body'] = $this->load->view($view, $data, TRUE);
		if ($convert_new_line) $data['body'] = convert_new_line($data['body']);
		$this->load->view($template, $data);
	}
	protected function pass_parameters(array &$data, array $names) {
		foreach ($names as $name) {
			$data[$name] = $this->input->post($name);
		}
	}
}
